 

efform_onload = function ()
{
	var info = new EiInfo();

	EiCommunicator.send("ZMCG11", "query", info, ajax_chang_callback);
}; 

function fundiv(currentIndex,index){

	var info = new EiInfo();

	if(index ==0)
		{
		
		EiCommunicator.send("ZMCG11", "query", info, ajax_chang_callback);
		}else
			{
			
			
			var xx = path[index]+"&fdMineId="+$('#fdMineId').val()+"&fdParentId="+$('#fdParentId').val();
		;
			var frame = frames[0];
			
			if ($(frame).attr("__src") != xx) {

				$(frame).attr("__src", xx);
				frame.src = xx;

				efform.setStatus(0, "正在加载...");
			}
			
			}
	
} 

var ajax_chang_callback = {
	onSuccess : function(eiInfo) {
		efwindow.hide();
		var grid = efgrid.getGridObject("ef_grid_result");
		grid.refresh(eiInfo);
		
	},
	onFail : function(eMsg) {
	}
};
var ajax_chang_callback2 = {
	onSuccess : function(eiInfo) {
		efwindow.hide();
		var grid = efgrid.getGridObject("ef_grid_detail");
		grid.refresh(eiInfo);
		
	},
	onFail : function(eMsg) {
	}
};
button_query_onclick = function (){
	efgrid.submitInqu( "ef_grid_result", "ZM","ZMCG11","query");
}
button_update_onclick = function (){ 
	var status=$('#inqu_status1-0-fdStatus').val();
//	if((status == "已发布")||(status == "待审批")){
//		alert("只能修改草拟或不通过的通知")
//	}
	
	var ei_info=new EiInfo();
	ei_info.setByNodeObject(document.forms[0]); 
	if(ei_info.getBlock('inqu_status1').getRows(0)[0][5].trim()==""){
		EFAlert("标题不能为空");
		return;
	}
	if(ei_info.getBlock('inqu_status1').getRows(0)[0][6].trim()==""){
		EFAlert("内容不能为空");
		return;
	}
	
	var info = getDetail("ef_region_inqu1","inqu_status1");
	if (null != info) {
		EiCommunicator.send("ZMCG11", "update", info, ajax_callback);
	}
	window.location.reload(); 
//	if (isSelected("ef_grid_result") == 0)return; 
//	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG11","update",true);
}
button_insert_onclick = function (){
	var ei_info=new EiInfo();
	ei_info.setByNodeObject(document.forms[0]); 
	if(ei_info.getBlock('inqu_status1').getRows(0)[0][5].trim()==""){
		EFAlert("标题不能为空");
		return;
	}
	if(ei_info.getBlock('inqu_status1').getRows(0)[0][6].trim()==""){
		EFAlert("内容不能为空");
		return;
	}
	
	var info = getDetail("ef_region_inqu1","inqu_status1");
	if (null != info) {
		EiCommunicator.send("ZMCG11", "insert", info, ajax_callback);
	}
	window.location.reload(); 
//	if (isSelected("ef_grid_result") == 0)return; 
//	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG11","insert",true);
}
button_delete_onclick = function (){
	if (isSelected("ef_grid_result") == 0)return; 
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		if(r)efgrid.submitForm( "ef_grid_result", "ZM","ZMCG11","delete",true);
	});
}

button_release_onclick = function () {
	if (isSelected("ef_grid_result") == 0)return; 
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG11","release",true);
}
button_top_onclick = function() {
	if (isSelected("ef_grid_result") == 0)return; 
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG11","top",true);
}
button_canceltop_onclick = function (){ 
	if (isSelected("ef_grid_result") == 0)return; 
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG11","cancelTop",true);
}

efgrid_afterAddNewRow = function(grid_id){
	var userId=$('#userId').val();
	var userName=$('#userName').val();
	var fdTime=$('#fdTime').val();

	var grid = efgrid.getGridObject(grid_id);
	var rows = grid.getCheckedRows();

	if(grid_id=="ef_grid_result")
	{
		for(var i = 0 ; i < rows.length;i++){
	
			grid.setCellValue(rows[i],2,userName,TYPE_DATA);
//			grid.setCellValue(rows[i],3,userId,TYPE_DATA);
			grid.setCellValue(rows[i],3,fdTime,TYPE_DATA);
		}
     }
}

efgrid_onRowClicked = function( grid_id, row_index ){ 
	if(grid_id == "ef_grid_result"){ 

		var grid = efgrid.getGridObject(grid_id); 
		var selectedRow=grid.getRowData(row_index);
		for(var item in selectedRow){
			var colname=item;
			var colvalue=selectedRow[item];
			$('#ef_region_inqu1').find('#inqu_status1-0-'+colname).val(colvalue);
		} 
		
	}
}


var ajax_callback = {
		onSuccess : function(eiInfo) {
			var grid = efgrid.getGridObject("ef_grid_result");
			grid.refresh(eiInfo);
		}, 
		onFail:function(eMsg)
		{
			alert("确认失败，原因："+eMsg);
		}

}	